// components/tab-bar/tab-bar.ts
import tran from "../utils/language";
Component({
    /**
     * 组件的属性列表
     */
    properties: {},
    /**
     * 组件的初始数据
     */
    data: {
        _t: tran._t("base"),
        activeKey: "home",
        items: [
            { label: "Home", key: "home" },
            { label: "Friends", key: "friends" },
            { label: "Metrics", key: "metrics" },
            { label: "CurriculumVitae", key: "curriculumVitae" },
        ],
        unReadCount: 0,
    },
    created() {
        getApp().getTotalUnreadCount();
        // this.setData({ unReadCount });
    },
    attached() {
        this.setData({
            unReadCount: getApp().globalData.totalUnread,
        });
    },
    /**
     * 组件的方法列表
     */
    methods: {
        switchTab(event: any) {
            wx.setStorage({
                key: "homeTabSel",
                data: "Users",
            });
            const key = event.currentTarget.dataset.value;
            const url = `/pages/${key}/index`;
            wx.switchTab({
                url,
            });
        },
    },
});
